<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>苹果属性选择表列表</title>
</head>
<body>
<form>
       输入关键字：<input id="keyword" name="keyword"/>
    <input type="button" value="查询" id="cxBtn"/>
</form>
<table width="100%" border="1">
    <caption>苹果属性选择表列表</caption>
    <thead>
    <tr style="font-weight:bold;background:#a0a0ff">
            <td>选择主ID</td>
            <td>商品ID</td>
            <td>二级分类ID</td>
            <td>三级分类ID</td>
            <td>订单ID</td>
            <td>品牌</td>
            <td>型号</td>
            <td>操作系统</td>
            <td>颜色</td>
            <td>机身内存</td>
            <td>入网型号</td>
            <td>购买渠道</td>
            <td>保修时长</td>
            <td>苹果ID是否可退出</td>
            <td>边框</td>
            <td>屏幕外观</td>
            <td>屏幕显示</td>
            <td>维修记录</td>
            <td>其他属性</td>
            <td>其他</td>
            <td>其他</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    </tbody>
</table>
<script src="/js/jquery-1.12.4.js"></script>
    <script>
    $(function(){
        fill("/applepropertieschoose/findAll.json","");
        $("#cxBtn").click(function(){
            fill("/applepropertieschoose/query.json",$("form").serialize());
        });
    });
    //填充数据
    function fill(url,data){
        $.getJSON(url,data,function(list){
            $("tbody").empty();
            for(var i in list){
                var detail = list[i];
                var str="<tr>";
                str+="<td>"+detail.chooseId+"</td><td>"+detail.productId+"</td><td>"+detail.twoCategoryId+"</td><td>"+detail.threeCategoryId+"</td><td>"+detail.orderId+"</td><td>"+detail.brand+"</td><td>"+detail.type+"</td><td>"+detail.operation+"</td><td>"+detail.color+"</td><td>"+detail.memory+"</td><td>"+detail.netModel+"</td><td>"+detail.buyWay+"</td><td>"+detail.repairTime+"</td><td>"+detail.appleId+"</td><td>"+detail.border+"</td><td>"+detail.screenFacade+"</td><td>"+detail.screenShow+"</td><td>"+detail.repairLog+"</td><td>"+detail.otherProperty+"</td><td>"+detail.other1+"</td><td>"+detail.other2+"</td>";
                str+="<td><a href='javascript:view("+detail.chooseId+")'>查看</a>&nbsp;&nbsp;";
                str+="<a href='javascript:update("+detail.chooseId+")'>修改</a>&nbsp;&nbsp;";
                str+="<a href='javascript:del("+detail.chooseId+")'>删除</a>";
                str+="</td></tr>";
                $("tbody").append(str);
            }
        });
    }
    //查看明细
    function view(chooseId){
        location.href="/admin/applepropertieschoose/detail.html?chooseId="+chooseId;
    }
    //更新
    function update(chooseId){
        location.href="/admin/applepropertieschoose/update.html?chooseId="+chooseId;
    }
    //删除
    function del(id){
        $.post("/applepropertieschoose/delete.json",
               {chooseId:chooseId},
               function(result){
                   if(result.flag==true){
                        fill("/applepropertieschoose/query.json",$("form").serialize());
                        alert("删除成功");
                   }else{
                        alert("删除失败");
                   }
               },"json");
    }
</script>
</body>
</html>